//
//  HDUser.swift
//  HDSwfitWeibo
//
//  Created by wty on 16/4/13.
//  Copyright © 2016年 wty. All rights reserved.
//

import UIKit

class HDUser: NSObject {
    //用户id
    var id:Int64 = 0
    //好友显示名称
    var name:String?
    //用户头像的地址
    var profile_image_url:String?
    //是否微博认证用户
    var verified:Bool = false
    //verified_type   没有认证-1 认证用户 0 企业认证2,3,5  达人:220
    var verified_type:Int = -1
    //会员等级
    var mbrank :Int = 0
    
    //认证图片
    var verifiedtypeIamge:UIImage?{
        switch verified_type {
        case 0: return UIImage(named: "avatar_vip")
        case 2,3,5 : return UIImage(named: "avatar_enterprise_vip")
        case 220 : return UIImage(named: "avatar_grassroot")
        default: return nil
        }
   
    }
    //会员图片
    var mbrankImage :UIImage?{
        if mbrank > 0 && mbrank <= 6 {
            return UIImage(named:"common_icon_membership_level\(mbrank)")
        }
        return nil
    }
    //头像的URL
    var  profileImageURL:NSURL? {
        if let urlString = profile_image_url {
            return NSURL(string: urlString)
        }
        return nil
    }
    //kvc构造器
    init(dict:[String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
    }
  //打印对象信息
    override var description:String {
        let keys = ["id","name","profile_image_url","verified","verified_type","mbrank"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
